<template>
  <div class="goods-attr-panel">
    <!-- 关闭按钮 -->
    <span class="close iconfont icon-guanbi" @click="emit('close')"></span>
    <!-- 标题 -->
    <div class="title">商品属性</div>
    <!-- 内容 -->
    <div class="properties">
      <div>
          <div class="item" v-for="(item, index) in goodsAttributes" :key="index">
            <span class="label">{{ item.name }}</span>
            <span class="value">{{ item.value }}</span>
          </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
defineProps({
  'goodsAttributes': {
    type: Array,
    default: []
  } as any
})
const emit =  defineEmits(['close'])
</script>

<style lang="scss" scoped>
.goods-attr-panel {
  padding: 0 15px;
  border-radius: 5px 5px 0 0;
  // position: relative;
  background-color: #fff;
  // height: 80vh;
  bottom: 0;
}

.title {
  line-height: 1;
  padding: 20px 0;
  text-align: center;
  font-size: 16px;
  font-weight: normal;
  border-bottom: 1px solid #ddd;
  color: #444;
}

.close {
  position: absolute;
  right: 12px;
  top: 12px;
  font-size: 25px;
}

.properties {
  padding: 0 10px;
  margin-bottom: 15px;
  .item {
    display: flex;
    flex-direction: row;
    line-height: 2;
    padding: 5px;
    font-size: 13px;
    color: #333;
    border-bottom: 1px dashed #ccc;
  }
  .label {
    width: 70px;

    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
  }
  .value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
  }
  .more {
    margin-left: 140px;
  }
}

.footer {
  display: flex;
  justify-content: space-between;
  padding: 10px 0 20px;
  font-size: 14px;
  color: #444;

  .button {
    flex: 1;
    height: 36px;
    text-align: center;
    line-height: 36px;
    margin: 0 10px;
    color: #fff;
    border-radius: 36px;
  }

  .primary {
    color: #fff;
    background-color: #27ba9b;
  }

  .secondary {
    background-color: #ffa868;
  }
}
</style>